//
//  global.hpp
//  NLCEQ_mixed
//
//  Created by Duong Ngo on 8/5/16.
//  Copyright © 2016 Duong Ngo. All rights reserved.
//

#ifndef global_hpp
#define global_hpp

#include <stdio.h>
#include <vector>
#include <string>
#include <map>

/* GLOBAL PARAMETERS */

//Bankers
extern const double varphi;      // Reserves Requirement
extern const double beta_b;      // Bankers's discount factor
extern const double Rn;  // Lower bound of interest on reserves
extern const double kappa;         // Capital requirement
extern const double thetaa;     // Cost of collecting loan
extern const double deltab;       // Loan amortization
extern const double kappa_shock;   // The initial value of kappa shock


//Households
extern const double beta_h;      // Household's discount factor
extern const double epsilon;        // Elasticity of substitution
extern const double alphaa;       // Parameters in production function
extern const double psi;          // Collateral constraints
extern const double deltak ;    // Capital depriciation
extern const double iota;           //Nominal Price Rigidity
extern const double chi;        // Labor disutility
extern const double bh_limit;     // Borrowing limit
extern const double nu;          // Inverse Frisch elasticity


//Government policy
extern const double phipie;    //Policy repsonds to inflation
extern const double phiy;       //Policy respond to output gap
extern const double rho_x; // Persistence of policy rule of LSAP

//Shock
extern const double rho; // Persistence of shock



//FOC Problem
extern const int var_foc; //Number of variables in each period
extern const int dim_state; // Number of state variables
extern const int dim_forward; // Number of foward variables
extern const int T; // Number of periods

//Other variables
extern const double s_max;    // Coefficient in soft-max constraint
extern const double Rf_min; // The minimum of FFR > Rn
extern double max_error; //Check the maximum error
extern const double pe;
extern const double x_shock;   // The initial shock of purchasing x
extern const double kappa_homotopy; // The value of kappa in homotopy
extern const int T_rn_back; // Time when Rn back to its steady state value


// Global vector
extern std::vector<double> result;  // Store result in Ipopt
extern std::vector<int> state_position; // Position of state var
extern std::vector<int> forward_position; // Position of forward var
extern std::map<std::string, int> original_map; // Map the name of variable to its position
extern std::vector<int> var_role; //Vector stores the role of each variable (<dim: state, dim: other)
extern std::vector<double> starting_state; // The state at time 0
extern std::map<std::string, int> eqn_map; //Map the name of equation to its position
extern std::vector<double> vec_kappa; //Exogenous variables
extern std::vector<double> vec_x; // Exogenous rule for purchasing x
extern std::vector<double> vec_rn; // Exogenous rule for Interest on Reserves


// Struct
struct variables {
    double  gamma, cb, Rf, Rm, ql, mur, muc, ip, pie, n, m, bh, k, tau, s, ch, etaz, lama, lamb, etab, i , pm, y, l, u, Rn, x, up, w;
    double gamma_f, ip_f, ql_f, lamb_f, lama_f, pm_f, pie_f, y_f, up_f, w_f;
    double n_p, m_p, bh_p, k_p, Rm_p, x_p, Rn_p;
};

















#endif /* global_hpp */
